-
Notifications
You must be signed in to change notification settings - Fork 1
HTTP client & tracing #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Сейчас поддержка прогресса сделана через tracing-indicatif. Возможно, стоит ещё прикрутить OSC9 progress для красоты |
Я бы сказал что поддержка со стороны терминалов слишком мала чтобы думать об этом в chainql Если однако ты добавишь это в indicatif, чтобы оно делало OSC9 для суммарно всех выбранных прогрессбаров (opt-in) - то можно и использовать |
В апстриме есть пожелание это иметь: console-rs/indicatif#596 |
Состояние indicatif пустое (Ни один из spanов не заopt-inился в отображение прогресса) - делаем 0 Что касаемо error/warning - в indicatif есть возможность удалить прогрессбар с сообщением, и тогда он ещё несколько секунд висит с сообщением... Однако будто бы оно мерцать будет так, и error/warning полезны только для программ с интерактивщиной... |
@CertainLach я поправил по замечаниям. Думаю, можно вливать |
header_span.pb_set_message("preloading keys"); | ||
header_span.pb_set_finish_message("all keys preloaded"); | ||
|
||
let header_span_enter = header_span.enter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если пользоваться header_span не нужно, то лучше сделать
let _header_span = header_span.entered();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как я вижу этот span не используется для логов, а поэтому лучше в него даже не входить явно тут, используй Future::instrument для тела block_on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понимаю. Мне же нужно не просто войти в спан, но и прописать "indicatif.pb_show = true" и засетапить текст и стили
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instrument делает автоматический вход в span при каждом poll Future
https://docs.rs/tracing/latest/tracing/span/struct.Span.html#in-asynchronous-code
Технически у нас тут block_on работает как await, а соответственно это к нему применимо
.query_storage(list, Some(self.block.as_ref())) | ||
.await?; | ||
|
||
Span::current().pb_inc(chunk_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше тут явно span использовать (через аргументы принимать, возможно Arc, особенно учитывая как они работают с async-await (для Futures надо делать future.instrument кроме .enter())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tokio может свои spanы для pollа добавлять, например если tokio-console включить
instrument() решает эту проблему, однако всё равно это выглядит неявно, pb_inc лучше на конкретном дёргать
And rewrite logs with tracing